<!DOCTYPE html>

<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<script src='../../editing/assert_selection.js'></script>
<script>
test(function () {
  assert_not_equals(window.internals, undefined,
                    'This test requires internals.');
  assert_selection(
    '<div contenteditable>^appla| </div>',
    selection => {
      const document = selection.document;
      const start = selection.anchorOffset;
      const end = selection.focusOffset;
      assert_false(internals.hasSpellingMarker(document, start, end));
      internals.setMarker(document, selection.getRangeAt(0), 'Spelling');
      assert_true(internals.hasSpellingMarker(document, start, end));
      internals.replaceMisspelled(document, 'apple');
    },
    '<div contenteditable>apple| </div>'
  );
}, 'test setMarker and replaceMisspelled in internals');
</script>
